<?php
namespace App\Services\Qrcode;

use QrCode;

/**
 * qrcode
 */
class SimpleQrcode
{
	//生成wifi二维码
    public function wifi(){
        $qrcode = QrCode::encoding('UTF-8')->wiFi([
            'ssid' => '恒瑞成科技',
            'encryption' => 'WPA',
            'password' => 'hrc888888',
        ]);
        return $qrcode;
    }
    //生成web商场二维码
    public function webStore($content, $path= '', $size = 300, $format = 'png', $error = 'H', $margin = 1, $encoding = 'UTF-8', $merge = '')
    {
        $qrcode = QrCode::size($size)
            ->format($format)
            ->margin($margin)
            ->errorCorrection($error)
            ->encoding($encoding);
        if($merge){
            $qrcode = $qrcode->merge($merge);
        }

        if($path == ''){
            $qrcode = $qrcode->generate($content);
        }else{
            $qrcode = $qrcode->generate($content, $path);
        }
        return $qrcode;
    }
}